<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="bootstrap-3.3.7-dist/css/bootstrap.css"/>
		<script type="text/javascript">
			function deleteById(id) {
				var isDelete = confirm("您确认要删除么?");
				if (isDelete) {
					location.href = "/JavaWeb1907/user?method=deleteById&id=" + id;
				}
			}
		</script>
	</head>
	<body>
		<form action="/JavaWeb1907/user?method=search" method="post">
			用户名：<input type="text" name="searchName"/>
			<input type="submit" value="搜索"/>
		</form>
		<%-- ${list} --%>
		<a class="btn btn-primary" href="/JavaWeb1907/user?method=getUserAddPage">添加</a>
		<table class="table table-striped table-bordered table-hover table-condensed">
			<tr>
				<td>#</td>
				<td>名字</td>
				<td>年龄</td>
				<td>性别</td>
				<td>部门</td>
				<td>删除</td>
				<td>修改</td>
			</tr>
			${list}
			<c:forEach items="${list}" var="map">
				<tr>
					<td>${map.id}</td>
					<td>${map.userName}</td>
					<td>${map.age}</td>
					<td>${map.gender}</td>
					<td>${map.deptName}</td>
					<%-- <td><a href="javascript:void(0)" onclick="deleteById(${user.id})">删除</a></td> --%>
					<td><a onclick="deleteById(${user.id})">删除</a></td>
					<td><a href="/JavaWeb1907/user?method=toUpdate&id=${user.id}">修改</a></td>
				</tr>
			</c:forEach>
		</table>
		
	</body>
</html>
